#import <Foundation/Foundation.h>
#import "LoginBackgroundView.h"

@implementation LoginBackgroundView


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
    CGFloat colors[] =
    {
        0.2, 0.9, 0.2, 0.2,
        0.2, 0.8, 0.8, 0.9,
        0.9, 0.8, 0.8, 0.2,
        0.2, 0.2, 0.9, 0.2,
    };
    CGGradientRef gradient = CGGradientCreateWithColorComponents(rgb, colors, NULL, 2);

    CGPoint start = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);
    CGPoint end = CGPointMake(self.frame.size.width/ 2, self.frame.size.height / 2);
    
    CGFloat startR = 0.0f;
    CGFloat endR = 500;

    CGContextRef graCtx = UIGraphicsGetCurrentContext();
    CGContextDrawRadialGradient(graCtx, gradient, start, startR, end, endR, 0);
    CGGradientRelease(gradient);
    gradient=nil;
    CGColorSpaceRelease(rgb);
}

@end
